<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<canvas><canvas id="canvas_premul"></canvas>
<canvas><canvas id="canvas_unpremul"></canvas>
<script>
// Premul code path
test(function() {
    gl = canvas_premul.getContext("webgl");
    gl.canvas.width += 65536;
    gl.canvas.height += 65536;
    gl.canvas.toDataURL();
}, "canvas.toDataURL() should not crash on a big premul canvas.");

// Unpremul code path
test(function() {
    var attributes = {premultipliedAlpha: false};
    gl = canvas_unpremul.getContext("webgl", attributes);
    gl.canvas.width += 65536;
    gl.canvas.height += 65536;
    gl.canvas.toDataURL();
}, "canvas.toDataURL() should not crash on a big unpremul canvas.");
</script>
